package org.robot.scm.infra;

import java.util.concurrent.LinkedBlockingDeque;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author : Awn create on 2024/5/23 10:47
 */
@Getter
@Slf4j
public class LinkBlockDeque<T> extends LinkedBlockingDeque<T> {

    private final String queueName;

    public LinkBlockDeque(String queueName) {
        this.queueName = queueName;
    }

    @Override
    public void put(T t) {
        try {
            super.put(t);
        } catch (Exception e) {
            log.error(e.getMessage());
        }
    }

    @Override
    public T take() {
        try {
            return super.take();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
